#pragma once
#include <fstream>
#include "case_insensitive_traits.h"
#include "httpClient.h"
#include "operatorResponse.h"

class HttpFileClient : public HttpClient
{
public:
	HttpFileClient(const Char* filePath,volatile bool& stopRequest);
	const OperatorResponse& getServerResponse();
	const volatile bool& stopRequested() const;
	virtual void get(const char* url);
protected:
	virtual void onMessage(const httplib::Result& res);
private:
	bool processResponse(const httplib::Response& response);
private:
	using case_insensitive_string = std::basic_string<char, case_insensitive_traits>;
	OperatorResponse res;
	bool jsonContent;
	int code;
	const Char* filePath;
	std::ofstream ofile;
	volatile bool& stopRequest;
};

